<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="_token" content="{{ csrf_token() }}"/>
	<link type="text/css" rel="stylesheet" href="{{ asset('css/ext.css') }}" />

<title>尤洪</title>
</head>
<body>  
<div class="log_bg">	
    <div class="top">
        <div class="logo"><a href="Index.html"><img src="/images/extimg/logo.png" /></a></div>
    </div>
	<div class="login">
    	<div class="log_img"><img src="/images/extimg/l_img.png" width="611" height="425" /></div>
		<div class="log_c">
          <form @submit.prevent="submit" method="POST">  
            <table border="0" style="width:370px; font-size:14px; margin-top:30px;" cellspacing="0" cellpadding="0">
              <tr height="50" valign="top">
              	<td width="55">&nbsp;</td>
                <td>
                	<span class="fl" style="font-size:24px;">登录</span>
                    <span class="fr">还没有商城账号，<a href="{{url('regist')}}" style="color:#ff4e00;">立即注册</a></span>
                </td>
              </tr>
              <tr height="70">
                <td>用户名</td>
                <td><input type="text" name="user_name" value="" v-model="inputtext.user_name" class="l_user" /></td>
              </tr>
              <tr height="70">
                <td>密&nbsp; &nbsp; 码</td>
                <td><input type="password" name="user_pwd" value="" v-model="inputtext.user_pwd" class="l_pwd" /></td>
              </tr>
              <tr>
              	<td>&nbsp;</td>
                <td style="font-size:12px; padding-top:20px;">
                	<span style="font-family:'宋体';" class="fl">
                    	<label class="r_rad"><input type="checkbox" /></label><label class="r_txt">请保存我这次的登录信息</label>
                    </span>
                    <span class="fr"><a href="#" style="color:#ff4e00;">忘记密码</a></span>
                </td>
              </tr>
              <tr height="60">
              	<td>&nbsp;</td>
                <td><input type="submit" value="立即登录" class="log_btn" /></td>
              </tr>
            </table>
            </form>
        </div>
    </div>
</div>
<script src="{{ mix('js/app.js') }}"></script>
<script type = "text/javascript">
new Vue({ 
      el: '.log_c', 
      data: { 
          inputtext:{} 
      }, 
      methods: { 
          submit: function() { 
            var data = this.inputtext;
            console.log(data)
            axios.post('http://shopapi.cn/api/auth/login', {
              user_name: data.user_name,
              user_pwd: data.user_pwd
            })
            .then(function (response) {
                layer.msg(response.data.msg,{icon:response.data.code,time:800},function(){
                  if(response.data.msg == "登录成功"){
                    axios.post('/do_login', {
                      token: response.data.data.token,
                    },).then(
                      res => location.href="{{url('/')}}"
                    );
                  }
                });
            })
            .catch(function (error) {
              alert(error.data.msg)
            });
            
          } 
      }, 
  }) 
</script>
</body>
</html>
